<?php


namespace App\Model;


use Illuminate\Database\Eloquent\Model;

/**
 * App\Model\Order
 *
 * @property int $id
 * @property string $order_sn 订单号
 * @property float $total_price 订单金额
 * @property float $goods_price 商品价格
 * @property float $shopping_price 运费
 * @property int $status 订单状态
 * @property string $remark 订单备注
 * @property string $shopping_no 物流单号
 * @property string|null $pay_at 支付时间
 * @property string $out_trade_no 第三方订单号
 * @property string $buy_name 购买人姓名
 * @property string $address 收货地址
 * @property string $zip_code 邮政编码
 * @property string $country 国家
 * @property string $city 城市
 * @property string $email 邮箱
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereBuyName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereCity($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereCountry($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereEmail($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereGoodsPrice($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereOrderSn($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereOutTradeNo($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order wherePayAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereRemark($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereShoppingNo($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereShoppingPrice($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereTotalPrice($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\Order whereZipCode($value)
 * @mixin \Eloquent
 */
class Order extends Model
{
    protected $table = 'order';

    protected $fillable = ['buy_name', 'address', 'zip_code', 'country', 'city', 'email'];

    /** @var int 订单默认状态 */
    const STATUS_NORMAL = 0;

    /** @var int 订单已付款 */
    const STATUS_PAY = 2;

    /**
     * 生成订单号
     * @author thanatos thanatos915@163.com
     */
    public function generateOrderSn()
    {
        $this->order_sn = date('YmdHis');
    }
}
